<?php
/**
 * 企业表单定制
 * gemj
 */
class EAdmin_Page_FormBook extends EAdmin_Page_Abstract
{
	private $resumeDb;
	private function loadDb()
	{
		$this->resumeDb = Db_Resume::instance();
	}
	public function validate(ME_Request $input, ME_Response $output)
	{
		$euserInfo = Libs_EUser::getLoginStatus($input,$output);
		$output->euid = 
			$input->euid =
			$euid = $euserInfo[0];

		if(empty($euid)){
			header("location:index.php?c=login");
		}

		$state = ME_Config::get("ResumeState");
		$output->book = $state['book'];

		return true;
	}

	public function doDefault(ME_Request $input, ME_Response $output)
	{
		$eid = $input->euid;
		$bookData = Libs_EForm::getEFormBook($eid);
		$output->bookData = $bookData;

		$output->setTemplate("FormBook");
	}

	public function doSave(ME_Request $input, ME_Response $output)
	{
		$params = $input->post();
		
		$re = Libs_EForm::saveEFormBook(array("eid"=>$input->euid,"book"=>$params));
		if($re){
			echo "<script>alert('保存成功!');window.location = 'index.php?c=FormBook';</script>";
			exit;
		}
	}

}
